|
|
|
|
|
|
|
|
|
|
|
|
|
include "../css/db_conn.inc";
$table = "bbs_notice";
function cutstr( $text , $cut_length ){
$text_len = strlen( $text );
$trim_len = strlen( substr( $text, 0, $cut_length ) );
If( $text_len > $trim_len ){
for( $jj = 0; $jj < $trim_len; $jj++ ){
$uu = ord( substr( $text, $jj, 1) );
if( $uu > 127 ){
$jj++;
}
}
$text2=substr($text,0,$jj)."..";
}else{
$jj=100;
$text2=substr($text,0,$jj);
}
return $text2;
}
########### Խù
$num_per_page ="20";
########### Խù ¸ ϴܿ ũ
$page_per_block = 10;
########## ͺ̽ Ѵ. ###########
if(!$page) {
$page = 1;
}
########## üԽù Ѵ. ##########
if (!eregi("[^[:space:]]+",$key)) {
$query = "SELECT count(Tot_No) FROM $table";
} else {
$encoded_key = urlencode($key);
$query = "SELECT count(Tot_No) FROM $table WHERE $keyfield LIKE '%$key%'";
}
$result = mysql_query($query,$conn);
if (!$result) {
echo ("QUERY_ERROR $query ");
exit;
}
$total_record = mysql_result($result,0,0);
########## Խù Ѵ. ##########
if(!$total_record) {
$first = 1;
$last = 0;
} else {
$first = $num_per_page*($page-1);
$last = $num_per_page*$page;
$IsNext = $total_record - $last;
if($IsNext > 0) {
$last -= 1;
} else {
$last = $total_record - 1;
}
}
########## ü Ѵ. ##########
$total_page = ceil($total_record/$num_per_page);
?>
|
|
|
|
|
if ($total_record != 0){
$time_limit = 60*60*24*$notify_new_article;
########## ڵ弼Æ?´. ##########
if(!eregi("[^[:space:]]+",$key)) {
$query="select * from $table $que1 order by Class_No desc,ansnum asc";
} else {
$query = "select * from $table WHERE $que2 $keyfield LIKE '%$key%' order by Tot_No desc";
}
$result= mysql_query($query,$conn);
if (!$result) {
echo ("QUERY_ERROR!!!!!!!");
exit;
}
########## Խù ȣ(Խù Ϸùȣ) ##########
$article_num = $total_record - $num_per_page*($page-1);
for($i = $first; $i <= $last; $i++) {
$num = mysql_result($result,$i,'Tot_No');
$theme= mysql_result($result,$i,'Theme');
$check= mysql_result($result,$i,'check_box');
$date = mysql_result($result,$i,'Date');
$Contact_No = mysql_result($result,$i,'Contact_No');
$file_name= mysql_result($result,$i,'file_name');
$Tm = cutstr($theme,50);
if($file_name != "" ) {
$fname = explode( ".",$file_name);
$ext = strtolower($fname[1]); // ̹ È È®
if($ext == "zip") { $file_img=""; }
if($ext == "xls") { $file_img=""; }
if($ext == "wav") { $file_img=""; }
if($ext == "ra") { $file_img=""; }
if($ext == "psd") { $file_img=""; }
if($ext == "ppt") { $file_img=""; }
if($ext == "pdf") { $file_img=""; }
if($ext == "png") { $file_img=""; }
if($ext == "mp3") { $file_img=""; }
if($ext == "jpg") { $file_img=""; }
if($ext == "gif") { $file_img=""; }
if($ext == "hwp") { $file_img=""; }
if($ext == "exe") { $file_img=""; }
if($ext == "doc") { $file_img=""; }
if($ext == "mid") { $file_img=""; }
if($ext == "bmp") { $file_img=""; }
if($ext == "st3") { $file_img=""; }
if($ext == "swf") { $file_img=""; }
} else { $file_img =""; }
$no = $total_record - $i;
?>
|
|
}
} else {?>
|
µ¥ÀÌŸ°¡ ¾ø½À´Ï´Ù.
|
}
$k = 18 - $last;
?>
|
|
########## Խù ϴ ̵ ִ ũ Ѵ. ##########
$total_block = ceil($total_page/$page_per_block);
$block = ceil($page/$page_per_block);
$first_page = ($block-1)*$page_per_block;
$last_page = $block*$page_per_block;
if($total_block <= $block) {
$last_page = $total_page;
}
########## Ï¿ Å© ##########
if($block > 1) {
$my_page = $first_page;
echo("[ ${page_per_block}] ");
}
########## � ٷ ̵ ִ ۸ũ Ѵ. ##########
for($direct_page = $first_page+1; $direct_page <= $last_page; $direct_page++) {
if($page == $direct_page) {
echo("$direct_page");
} else {
echo("$direct_page ");
}
echo (" | ");
}
########## Ï¿ Å© ##########
if($block < $total_block) {
$my_page = $last_page+1;
echo("[ ${page_per_block}]");
}
?>
|
|
|
for($i = 0; $i < $k; $i++) {
?>
|
|
}?>
|
|
|
|
|
|
|
|
|
|
|
|
|